﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using HVQCommon;

namespace HCommon
{
    public class Dialog
    {
        public enum mType { ok, err, warn, }

        public static void ShowMess(mType type, string Msg)
        {
            try
            {
                Image img = null;
                if (type == mType.ok)
                {
                    img = Properties.Resource.OK_64;
                }
                else if (type == mType.err)
                {
                    img = Properties.Resource.Error_64;
                }
                else if (type == mType.warn)
                {
                    img = Properties.Resource.Warn_64;
                }
                hDialog dlg = new hDialog(img, Msg);
                dlg.ShowDialog();
            }
            catch (Exception ex)
            {
                Common.GhiLog("ShowMess", ex);
            }
        }

        public static void ShowMess(int result)
        {
            try
            {
                Image img = null;
                if (result == 0)
                {
                    img = Properties.Resource.Warn_64;
                    hDialog dlg = new hDialog(img, "Lưu dữ liệu không thành công.");
                    dlg.ShowDialog();
                }
                else 
                {
                    img = Properties.Resource.OK_64;
                    hDialog dlg = new hDialog(img, "Đã lưu thành công " + result.ToString() + " bản ghi.");
                    dlg.ShowDialog();
                }
                
            }
            catch (Exception ex)
            {
                Common.GhiLog("ShowMess", ex);
            }
        }
    }
}
